﻿@namespace MudBlazor
@inherits MudComponentBase

<MudToolBar @attributes="UserAttributes" Class="@Classname" Style="@Style">
    @if (HorizontalAlignment == HorizontalAlignment.End || 
        (HorizontalAlignment == HorizontalAlignment.Right && !RightToLeft) || 
        (HorizontalAlignment == HorizontalAlignment.Left && RightToLeft) || 
         HorizontalAlignment == HorizontalAlignment.Center)
    {
        <div class="mud-table-pagination-spacer"></div>
    }
    @if (!HideRowsPerPage)
    {
        <div class="@PaginationClassname">
            <div class="mud-table-pagination-caption">
                <div class="mud-table-pagination-information">@RowsPerPageString</div>
            </div>
            <MudSelect T="string" ValueChanged="SetRowsPerPage" Value="@Table?.RowsPerPage.ToString()" Class="mud-table-pagination-select" DisableUnderLine="true" Dense="true">
            @foreach (int pageSize in PageSizeOptions)
            {
                <MudSelectItem T="string" Value="@pageSize.ToString()">@pageSize.ToString().ToUpper()</MudSelectItem>
            }
            </MudSelect>
        </div>
    }
    @if (!HidePageNumber)
    {
        <div class="mud-table-pagination-caption">
            <div class="mud-table-page-number-information">@Info</div>
        </div>
    }
    @if (!HidePagination)
    {
        <div class="mud-table-pagination-actions">
            <MudIconButton Class="mud-flip-x-rtl" Icon="@Icons.Material.Filled.FirstPage" Disabled="@BackButtonsDisabled" @onclick="@(() => Table.NavigateTo(Page.First))" />
            <MudIconButton Class="mud-flip-x-rtl" Icon="@Icons.Material.Filled.NavigateBefore" Disabled="@BackButtonsDisabled" @onclick="@(() => Table.NavigateTo(Page.Previous))" />
            <MudIconButton Class="mud-flip-x-rtl" Icon="@Icons.Material.Filled.NavigateNext" Disabled="@ForwardButtonsDisabled" @onclick="@(() => Table.NavigateTo(Page.Next))" />
            <MudIconButton Class="mud-flip-x-rtl" Icon="@Icons.Material.Filled.LastPage" Disabled="@ForwardButtonsDisabled" @onclick="@(() => Table.NavigateTo(Page.Last))" />
        </div>
    }
    @if (HorizontalAlignment == HorizontalAlignment.Start ||
      (HorizontalAlignment == HorizontalAlignment.Left && !RightToLeft) ||
      (HorizontalAlignment == HorizontalAlignment.Right && RightToLeft) ||
       HorizontalAlignment == HorizontalAlignment.Center)
    {
        <div class="mud-table-pagination-spacer"></div>
    }
</MudToolBar>

